import { RouteRecordRaw } from "vue-router";
import HomeView from "@/views/HomeView.vue";
import UserLoginView from "@/views/user/UserLoginView.vue";
import UserRegisterView from "@/views/user/UserRegisterView.vue";
import ACCESS_ENUM from "@/access/accessEnum";
import UserLayout from "@/layouts/UserLayout.vue";

export const routes: Array<RouteRecordRaw> = [

  {
    path:"/user",
    name:"用户",
    component:UserLayout,
    meta :{
      hideInMenu: true
    },
    children:[
      {
        path:"/user/login",
        name:"用户登录",
        component: UserLoginView
      },
      {
        path:"/user/register",
        name:"用户注册",
        component :UserRegisterView
      }
    ]
  },
  {
    path:"/add/question",
    name:"创建题目",
    component:() =>import("../views/question/AddQuestionView.vue"),
    meta :{
      menu:true,
      // "access" :ACCESS_ENUM.ADMIN
    }
  },
  {
    path:"/update/question/:id",
    name:"更新题目",
    component:() =>import("../views/question/AddQuestionView.vue"),
    meta :{
      menu:true,
      // "access" :ACCESS_ENUM.ADMIN
    }
  },
  {
    path: "/",
    name: "主页",
    component: HomeView,
    meta :{menu:true},
  },
  {
    path: "/about",
    name: "关于我们",
    meta :{menu:true},
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () =>
      import(/* webpackChunkName: "about" */ "../views/AboutView.vue"),
  },
  {
    path: "/admin",
    name: "管理员界面",
    meta :{
      menu:true,
      "access":ACCESS_ENUM.ADMIN
    },
    component:()=> import( "../views/AdminView.vue"),
  },
  {
    path: "/noAuth",
    name: "403",
    meta :{
      menu:true,

    },
    component:()=> import( "../views/NoAuthView.vue"),
  },

  {
    path:"/hide",
    name:"隐藏",
    component:()=> HomeView,
    meta :{
      hideInMenu:true,
    },
  }


];
